<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>我的资料-个人中心</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <!--<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">-->
    <link rel="stylesheet" href="__STATIC__/style/weui.min.css">
    <link rel="stylesheet" href="__STATIC__/style/cmgd.css">


    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/admin/js/jquery.form.js"></script>
    <script src="/static/admin/js/plugins/layer/laydate/laydate.js"></script>
    <script src="/static/pc/js/layer/layer.js"></script>
    <script src="/static/admin/js/laypage/laypage.js"></script>
    <script src="/static/admin/js/laytpl/laytpl.js"></script>
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <!--奥森图标-->
    <link rel="stylesheet" href="__STATIC__/style/FontAwesome_4.2.0/css/font-awesome.min.css">
    <style>
        .text{padding-left:9px; }
        .placeholder{text-align: center;}
        .fl{text-align: left;}
        .black{color:#000; font-weight: 600;font-size:17px; line-height: 1.8;}
        .color1{color:#30ab88;}
        .color2{color:#1aafe7;}
        .color3{color:#ffc242;}
        .edit{font-size:13px;color:#999;padding-left: 20px;}
        .color4{color:#eb6877;}
        .weui-cell__bd p i{padding: 0 10px 0 2px; font-size: 20px;}
        .weui-cell__bd p{font-size:16px;}
    </style>
</head>
<body>


<!--顶部搜索-->
<div class="page home js_show">

    <!--选择导航-->
    <form id="form" action="{:url('usercenter/user_edit')}" enctype="multipart/form-data" method="post">
    <div class="page__bd ">

        <div class="weui-cells__title">帐号:</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" placeholder="请输入昵称"  value="{$info.account}"  readonly  >
                </div>
            </div>
        </div>

        <div class="weui-cells__title">昵称:</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" placeholder="请输入昵称" name="nickname" id="nickname" value="{$info.nickname}"       {if condition="$info.group_id ==8"}readonly{/if}      >
                </div>
            </div>
        </div>
        <div class="weui-cells__title">密码(不修改密码时留空):</div>
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" placeholder="请输入密码" name="password" id="password" value="" >
                </div>
            </div>
        </div>
        {if condition="$info.group_id !=8"}
        <div class="weui-cells__title">真实姓名:</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" placeholder="请输入真实姓名" name="realname" value="{$info.realname}" >
                </div>
            </div>
        </div>
        {/if}






        <div class="weui-cells__title">简介:</div>
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <textarea class="weui-textarea" name="desc" id="desc" placeholder="请输入简介" rows="5">{$info.desc}</textarea>
                </div>
            </div>
        </div>



        <div class="weui-cells__title">上传头像</div>
        <div class="weui-cells weui-cells_form" style="padding-top:6px;">
            <div class="weui-cell__bd">
                <div class="weui-uploader">
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="uploaderFiles">{if condition="$info.head_img !=''"}<li class="weui-uploader__file" style="background-image:url('/uploads/face/{$info.head_img}')"></li>{/if}</ul>
                        <div class="weui-uploader__input-box">
                            <input id="uploaderInput" name="img" class="weui-uploader__input" type="file"  />
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="weui-btn-area">

            <button class="weui-btn weui-btn_primary" type="submit"> 确定 </button>

            <!--<a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips" >确定</a>-->
        </div>

    </div>
    </form>
</div>
</body>

<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>
<script type="text/javascript">

    $(function(){
        var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
                $gallery = $("#gallery"), $galleryImg = $("#galleryImg"),
                $uploaderInput = $("#uploaderInput"),
                $uploaderFiles = $("#uploaderFiles");
        $uploaderInput.on("change", function(e){
            var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
            for (var i = 0, len = files.length; i < len; ++i) {
                var file = files[i];
                if (url) {
                    src = url.createObjectURL(file);
                } else {
                    src = e.target.result;
                }
                $uploaderFiles.html($(tmpl.replace('#url#', src)));
            }
        });
        $uploaderFiles.on("click", "li", function(){
            $galleryImg.attr("style", this.getAttribute("style"));
            $gallery.fadeIn(100);
        });
        $gallery.on("click", function(){
            $gallery.fadeOut(100);
        });

    });


//    function submit(){
//        var nickname =   $('#title').val();
//        var desc =   $('#desc').val();
//        var is_img =   $('#uploaderFiles').html();
//
//        if(nickname==''){
//            layer.msg('昵称不能为空',{icon:5,time:1000,shade: 0.1,});
//            return false;
//        }
//
//        if(desc==''){
//            layer.msg('简介不能为空',{icon:5,time:1000,shade: 0.1,});
//            return false;
//        }
//
//        if(is_img==''){
//            layer.msg('请上传头像',{icon:5,time:1000,shade: 0.1,});
//            return false;
//        }
//        $('#form').submit()
//
//    }


    $(function(){
        $('#form').ajaxForm({
            beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
            success: complete, // 这是提交后的方法
            dataType: 'json'
        });

        function checkForm(){
            var nickname =   $('#title').val();
            var desc =   $('#desc').val();
            var peopleid =   $('#peopleid').val();
            var realname =   $('#realname').val();
            var is_img =   $('#uploaderFiles').html();

            if(nickname==''){
                layer.msg('昵称不能为空',{icon:5,time:1000,shade: 0.1,});
                return false;
            }

            if(desc==''){
                layer.msg('简介不能为空',{icon:5,time:1000,shade: 0.1,});
                return false;
            }

            if(is_img==''){
                layer.msg('请上传头像',{icon:5,time:1000,shade: 0.1,});
                return false;
            }

            if(peopleid==''){
                layer.msg('身份证号不能为空',{icon:5,time:1000,shade: 0.1,});
                return false;
            }

            if(realname==''){
                layer.msg('真实姓名不能为空',{icon:5,time:1000,shade: 0.1,});
                return false;
            }

        }

        function complete(data){
            if(data.code == 1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                    window.location.href="{:url('Usercenter/index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
        }

    });



//    function quitlogin(){
//        $.post('{:url("usercenter/quitlogin")}',
//                {id:1},
//                function(data){
//                    console.log(data);
//                    if(data.code==1) {
//
//                        layer.msg(data.msg,{icon:1,time:1000,shade: 0.1,});
//
//                        window.location.href="{:url('user/login')}";
//                    }else{
//                        layer.msg(data.msg,{icon:5,time:1000,shade: 0.1,});
//                    }
//
//                });
//    }
</script>


</html>